9480634eda44ccb903f457281658c3f588473285,folding-cell/src/main/java/com/ramotion/foldingcell/FoldingCell.java,FoldingCell,startExpandHeightAnimation,#number#number#number#number#,305
Before Change
ArrayList<Animation> heightAnimations = new ArrayList<>();
for (int i = 1; i < partsCount; i++) {
int heightDelta = i != partsCount - 1 ? bigPartHeight : smallPartHeight;
HeightAnimation heightAnimation = new HeightAnimation(this, i * bigPartHeight, i * bigPartHeight + heightDelta);
heightAnimation.setDuration(partAnimationDuration);
heightAnimation.setInterpolator(new DecelerateInterpolator());
heightAnimations.add(heightAnimation);
}
createAnimationChain(heightAnimations, this);
this.startAnimation(heightAnimations.get(0));
After Change
* @param partAnimationDuration one part animate duration
* @param viewHeights heights of animation parts
*/
protected void startExpandHeightAnimation(ArrayList<Integer> viewHeights, int partAnimationDuration) {
if (viewHeights == null || viewHeights.isEmpty())
throw new IllegalArgumentException("ViewHeights array must have at least 2 elements");
ArrayList<Animation> heightAnimations = new ArrayList<>();
int fromHeight = viewHeights.get(0);
for (int i = 1; i < viewHeights.size(); i++) {
int toHeight = fromHeight + viewHeights.get(i);
heightAnimations.add(new HeightAnimation(this, fromHeight, toHeight, partAnimationDuration)
.withInterpolator(new DecelerateInterpolator()));
fromHeight = toHeight;
}
createAnimationChain(heightAnimations, this);
this.startAnimation(heightAnimations.get(0));